//============================================================================
// Name        : csiena
// Author      : Josh Lospinoso
// Copyright   : MIT License
// Description : Austere, limited implementation of the R package RSiena in
//				 C++. Used for fast maximum likelihood and method of moments
//				 estimation of stochastic actor oriented models (SAOMs)
//				 without any frills or user experience niceties.
//============================================================================

#ifndef CRIMP_EVALUATION_H_
#define CRIMP_EVALUATION_H_
#include "globals.h"
#include "digraph.h"
#include "evaluation.h"

namespace csiena {
class CrimpEvaluation : public Evaluation {
public:
	// Initializers
	CrimpEvaluation(int actors);
	CrimpEvaluation(const CrimpEvaluation &donorEvaluation);
	virtual ~CrimpEvaluation();

	// Accessors
	double getGamma(int gammaIndex);
	void incrementGamma(int gammaIndex, double value);
	void setGamma(int gammaIndex, double value);
	double getLogLikelihood();
	double getScore(int gammaIndex);
	double getInformation(int gammaIndex1, int gammaIndex2);
	double getStatistics(int index);

	// Calculation methods -- Most computationally intensive!
	void evaluate(Digraph* observedDigraph, Digraph* trueDigraph);

	// Utility methods
	void print();
	bool isCrimpEvaluation();

private:
	int actors;
	double *gamma;
	double logLikelihood;
	double *statistics;
	double *score;
	double *information;
	void setStatistics(int index, double value);
	void setScore(int gammaIndex, double value);
	void setInformation(int gammaIndex1, int gammaIndex2, double value);
	void resetStatistics();
};

}

#endif /* CRIMP_EVALUATION_H_ */
